home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 - Homepage / CHIP.BIN / share / htmledit / bashhtml / bashhtml.exe / %AppDir% / scripts / Highlight Image.txt < prev    next >
Encoding:
Text File  |  2003-09-01  |  1.6 KB  |  51 lines

  1. [DESCRIPTION]Lights up the cells of a table as the mouse moves over them.[/DESCRIPTION]
  2.  
  3. [HEAD CODE]<script language="JavaScript1.2">
  4.  
  5. <!--
  6. //Highlight Table Cells -- By Dynamic Drive
  7. //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
  8. //This credit MUST stay intact for use
  9.  
  10. var ns6=document.getElementById&&!document.all
  11. var ie=document.all
  12.  
  13. function changeto(e,highlightcolor){
  14. source=ie? event.srcElement : e.target
  15. if (source.tagName=="TR"||source.tagName=="TABLE")
  16. return
  17. while(source.tagName!="TD"&&source.tagName!="HTML")
  18. source=ns6? source.parentNode : source.parentElement
  19. if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
  20. source.style.backgroundColor=highlightcolor
  21. }
  22.  
  23. function contains_ns6(master, slave) {
  24. while (slave.parentNode)
  25. if ((slave = slave.parentNode) == master)
  26. return true;
  27. return false;
  28. }
  29.  
  30. function changeback(e,originalcolor){
  31. if
  32. (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TR"||source.tagName=="TABLE")
  33. return
  34. else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
  35. return
  36. if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
  37. source.style.backgroundColor=originalcolor
  38. }
  39.  
  40. -->
  41. </script>[/HEAD CODE]
  42.  
  43. [BODY CODE][/BODY CODE]
  44.  
  45. [NOTES]To use this script, place the following code inside a table tag:
  46.  
  47. onMouseover = "changeto(event, '#FFDD00')" onMouseout = "changeback(event, '#FFFFFF')"
  48.  
  49. To exclude a cell from being highlighted, place this code inside the <td> tag:
  50.  
  51. id="ignore"[/NOTES]